package com.sgb.kjwl.view.widget.self;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.alibaba.android.arouter.launcher.ARouter;
import com.sgb.capital.view.ui.activity.CapitalActivity;
import com.sgb.goods.utils.Constants;
import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.self.PermissionMenuEntity;
import com.sgb.kjwl.view.ui.activity.manage.special.SpecialMenBerNewActivity;
import com.swgk.core.base.aroute.ARouterStartWebBase;
import com.swgk.core.util.ACAdminDialogUtils;
import com.sgb.kjwl.utils.ActivityJump;
import com.sgb.kjwl.utils.DialogFunction;
import com.sgb.kjwl.view.ui.activity.ShoppingCar.ShoppingCartActivity;
import com.sgb.kjwl.view.ui.activity.chat.ContactBookActivity;
import com.sgb.kjwl.view.ui.activity.enterprise.AddNeedListActivity;
import com.sgb.kjwl.view.ui.activity.enterprise.MakeOverPublishMainActivity;
import com.sgb.kjwl.view.ui.activity.enterprise.PublishServiceListActivity;
import com.sgb.jicai.view.activity.MyCenterXuFangFaQiActivity;
import com.sgb.kjwl.view.ui.activity.leaseAsk.MyAskLeaseActivity;
import com.sgb.kjwl.view.ui.activity.manage.AgentMonitoringReportActivity;
import com.sgb.kjwl.view.ui.activity.manage.UpLoadActivity;
import com.sgb.kjwl.view.ui.activity.manage.VrListActivity;
import com.sgb.kjwl.view.ui.activity.manage.WebSiteAddressActivity;
import com.sgb.kjwl.view.ui.activity.manage.WebSiteInquiryActivity;
import com.sgb.kjwl.view.ui.activity.manage.WebsiteAnnouncementManagementActivity;
import com.sgb.kjwl.view.ui.activity.manage.WebsiteReleaseActivity;
import com.sgb.kjwl.view.ui.activity.manage.special.InviteMemberActivity;
import com.sgb.kjwl.view.ui.activity.manage.special.MemberUnitActivity;
import com.sgb.kjwl.view.ui.activity.manage.special.SpecialMemberActivity;
import com.sgb.jicai.view.activity.FactoryJicaiActivity;
import com.sgb.zhaocai.view.activity.PickInvitedApplyListActivity;
import com.sgb.kjwl.view.ui.activity.self.ApprovalManagerActvity;
import com.sgb.kjwl.view.ui.activity.self.JoinCompanyActivity;
import com.sgb.kjwl.view.ui.activity.self.SelfQrCodeActivity;
import com.sgb.kjwl.view.ui.activity.self.SuggestionFeedbackActivity;
import com.sgb.kjwl.view.ui.activity.self.authentication.AuthActivity3;
import com.sgb.kjwl.view.ui.activity.self.authentication.CertificationActivity;
import com.sgb.kjwl.view.ui.activity.self.company.InviteActivity;
import com.sgb.kjwl.view.ui.activity.self.company.ManagementDynamicActivity;
import com.sgb.kjwl.view.ui.activity.self.company.PriceCompetitionActivity;
import com.sgb.kjwl.view.ui.activity.self.mine.FastMenuActivity;
import com.sgb.kjwl.view.ui.activity.self.mine.IntelligentAttentionActivity;
import com.sgb.kjwl.view.ui.activity.self.mine.MonitoringReportActivity;
import com.sgb.kjwl.view.ui.activity.self.packers.LaborServiceAndEmploymentPublishListActivity;
import com.sgb.kjwl.view.ui.activity.self.packers.SelfPackersManageActivity2;
import com.sgb.kjwl.view.ui.activity.self.packers.SelfTeamEmploymentActivity;
import com.sgb.kjwl.view.ui.activity.self.publish.GoodsListActivity3;
import com.sgb.kjwl.view.ui.activity.self.publish.GoodsPublishActivity;
import com.sgb.kjwl.view.ui.activity.self.publish.SelfLeaseListActivity;
import com.sgb.kjwl.view.ui.activity.self.publish.SettingActivity;
import com.sgb.member.ui.activity.MemberInviteOrApplyActivity;
import com.swgk.core.dialog.RoundCornerDialog;
import com.swgk.core.util.MToast;
import com.swgk.core.util.SharedPreferenceUtil;

import org.greenrobot.eventbus.EventBus;

import java.util.ArrayList;


public class MenuClickUtils {

    private static final int TYPE_PERSON = 0;
    private static final int TYPE_COMPANY = 1;
    private static final int TYPE_GROUP = 2;
    private static final int TYPE_ORGANIZATION = 3;
    private static volatile MenuClickUtils mMenuClickUtils;

    private MenuClickUtils() {

    }

    public static MenuClickUtils getInstance() {
        try {
            if (mMenuClickUtils == null) {
                synchronized (MenuClickUtils.class) {
                    mMenuClickUtils = new MenuClickUtils();
                }
            }
        } catch (Exception e) {

        }
        return mMenuClickUtils;
    }

    /**
     * 菜单点击事件
     *
     * @param entity
     * @param mType 0 个人 1 企业 2 团队
     */
    ArrayList<PermissionMenuEntity.ListEntity> listMores = new ArrayList<>();

    public void handlerClickItem(Context context, PermissionMenuEntity.ListEntity entity, int mType) {
        if (!TextUtils.isEmpty(entity.getName())) {
            switch (entity.getName()) {
                case "1_daibanshixiang":
                    ApprovalManagerActvity.start(context, 0);
                    break;
                case "2_wofaqi":
                    ApprovalManagerActvity.start(context, 1);
                    break;
                case "3_yishenpi":
                    ApprovalManagerActvity.start(context, 2);
                    break;
                case "4_chaosongwo":
                    ApprovalManagerActvity.start(context, 3);
                    break;
                case "5_hanxun": //会员
                    //if (mType == TYPE_ORGANIZATION) {
                    //MToast.showToast(context, "功能开发中，敬请期待");
                    //} else {
//                        if (mType == TYPE_PERSON) {
//                            if (!SharedPreferenceUtil.getInstance().getSaveBooleanData(SharedPreferenceUtil.PERSON_AUTH, false)) {
//                                ACAdminDialogUtils.showACDialog(ACAdminDialogUtils.TYPE_AUTH_NO_AC, context);
//                                return;
//                            }
//                        }
                    WebSiteInquiryActivity.Companion.start(context);
                    //}
                    break;
                case "6_shangji": //商机
                    if (mType == TYPE_COMPANY || mType == TYPE_PERSON) {
                        MToast.showToast(context, "功能开发中，敬请期待");
                    }
                    break;
//                case "7_dingdan":
//                    if (mType == TYPE_PERSON) {
//                        if (!SharedPreferenceUtil.getInstance().getSaveBooleanData(SharedPreferenceUtil.PERSON_AUTH, false)) {
//                            ACAdminDialogUtils.showACDialog(ACAdminDialogUtils.TYPE_AUTH_NO_AC, context);
//                            return;
//                        }
//                        PersonOrderActivity.Companion.launch(context);
//                    }
//                    break;
                case "8_fukuan": // 反馈
                    if (mType == TYPE_PERSON) {
                        MToast.showToast(context, "功能开发中，敬请期待");
                    }
                    break;
                case "9_jiandu": // 监督
                    if (mType == TYPE_PERSON) {
                        if (!SharedPreferenceUtil.getInstance().getSaveBooleanData(SharedPreferenceUtil.PERSON_AUTH, false)) {
                            ACAdminDialogUtils.showACDialog(ACAdminDialogUtils.TYPE_AUTH_NO_AC, context);
                            return;
                        }
                        MonitoringReportActivity.start(context);
                    } else if (mType == TYPE_COMPANY || mType == TYPE_GROUP || mType == TYPE_ORGANIZATION) {
                        AgentMonitoringReportActivity.Companion.launch(context);
                    }
                    break;
                case "1_daiban": //待办
                    if (mType == TYPE_COMPANY) {
                        ApprovalManagerActvity.start(context, 0);
                    }
                    break;
                case "12_ucjingjia":// 集采
                    if (mType == TYPE_COMPANY) {
                        PriceCompetitionActivity.Companion.launch(context);
                    }
                    break;
                case "14_guanzhu":// 关注
                    if (mType == TYPE_PERSON) {
                        if (!SharedPreferenceUtil.getInstance().getSaveBooleanData(SharedPreferenceUtil.PERSON_AUTH, false)) {
                            ACAdminDialogUtils.showACDialog(ACAdminDialogUtils.TYPE_AUTH_NO_AC, context);
                            return;
                        }
                        IntelligentAttentionActivity.start(context);
                    }
                    break;
                case "15_jingying": //经营
                    if (mType == TYPE_COMPANY) {
                        ManagementDynamicActivity.Companion.launch(context);
                    }
                    break;
                case "17_zhaobiao"://招标
                    if (mType == TYPE_COMPANY) {
                        MToast.showToast(context, "功能开发中，敬请期待");
                    }
                    break;
                case "22_gouwuche"://购物车
                    if (mType == TYPE_COMPANY) {
                        if (SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.LOGIN_TOKEN, "").equals("")) {//采购单
                            EventBus.getDefault().postSticky("transport_to_login");
                        } else {
                            ShoppingCartActivity.start(context);
                        }
                    }
                    break;
                case "23_yaoqing"://邀请
                    if (mType == TYPE_COMPANY || mType == TYPE_PERSON) {
                        InviteActivity.Companion.launch(context);
                    }
                    break;
            }
        }
    }

    public void handlerWebsiteMenu(Context context, int mType, boolean isMyself, PermissionMenuEntity.ListEntity entity) {
        if (!TextUtils.isEmpty(entity.getName())) {
            switch (entity.getName()) {
                case "5_hanxun":
                    if (isMyself) {
//                        if (mType == TYPE_ORGANIZATION) {
//                            MToast.showToast(context, "功能开发中，敬请期待");
//                        } else {
                        if (mType == TYPE_PERSON) {
                            if (!SharedPreferenceUtil.getInstance().getSaveBooleanData(SharedPreferenceUtil.PERSON_AUTH, false)) {
                                ACAdminDialogUtils.showACDialog(ACAdminDialogUtils.TYPE_AUTH_NO_AC, context);
                                return;
                            }
                        }
                        WebSiteInquiryActivity.Companion.start(context);
                        //}
                    }
                    break;
                case "8_fukuan":
                    if (mType == TYPE_PERSON) {
                        MToast.showToast(context, "功能开发中，敬请期待");
                    }
                    break;
                case "9_jiandu":
                    if (mType == TYPE_PERSON) {
                        if (!SharedPreferenceUtil.getInstance().getSaveBooleanData(SharedPreferenceUtil.PERSON_AUTH, false)) {
                            ACAdminDialogUtils.showACDialog(ACAdminDialogUtils.TYPE_AUTH_NO_AC, context);
                            return;
                        }
                        MonitoringReportActivity.start(context);
                    } else if (mType == TYPE_COMPANY || mType == TYPE_GROUP || mType == TYPE_ORGANIZATION) {
                        AgentMonitoringReportActivity.Companion.launch(context);
                    }
                    break;
                case "1_daiban":
                    if (mType == TYPE_COMPANY) {
                        ApprovalManagerActvity.start(context, 0);
                    }
                    break;
                case "12_jingjia":
                    if (mType == TYPE_COMPANY) {
                        PriceCompetitionActivity.Companion.launch(context);
                    }
                    break;
                case "14_guanzhu":
                    if (mType == TYPE_PERSON) {
                        if (!SharedPreferenceUtil.getInstance().getSaveBooleanData(SharedPreferenceUtil.PERSON_AUTH, false)) {
                            ACAdminDialogUtils.showACDialog(ACAdminDialogUtils.TYPE_AUTH_NO_AC, context);
                            return;
                        }
                        IntelligentAttentionActivity.start(context);
                    }
                    break;
                case "28_jubao": //举报
                    MToast.showToast(context, "功能开发中");
                    break;
                default:
                    MToast.showToast(context, "功能开发中");
                    break;
            }
        }
    }

    public void handlerSelfMenu(Context context, int mType, PermissionMenuEntity.ListEntity entity) {
        if (!TextUtils.isEmpty(entity.getName())) {
            switch (entity.getName()) {
                case "0_qiyexiangce"://宣传展示
                    WebsiteReleaseActivity.start(context, WebsiteReleaseActivity.QIYEXIANGCE);
                    break;
                //首页各种发布
                case "0_shangpinfabu": //商品发布
                    GoodsPublishActivity.start(context);
                    break;
                case "0_zhaobiaofabu": //招标发布
                    MToast.showToast(context, context.getResources().getString(R.string.self_no_permission));
                    break;
                case "0_fabuhuoyuan": //发布货源
                    MToast.showToast(context, context.getResources().getString(R.string.self_no_permission));
                    break;
                case "0_jicaifabu"://集采需方发布
                    MyCenterXuFangFaQiActivity.start(context, "1");
                    break;
                case "0_gongduifabu"://工队发布
                case "15_gongchengjingying"://工程经营
                    SelfPackersManageActivity2.start(context);
                    break;
                case "0_gongrenfabuhome"://工人发布
                case "15_yonggongxuqiu"://用工需求
                    SelfTeamEmploymentActivity.start(context);
                    break;
                case "0_laowufabu"://劳务发布
                    ActivityJump.jumpToActivity(context, LaborServiceAndEmploymentPublishListActivity.class);
                    break;
                case "0_huoyunfabu"://货运发布 普通货源
                    MToast.showToast(context, context.getResources().getString(R.string.self_no_permission));
                    break;
                case "0_zulinfabu"://租赁发布
                case "15_zulinjingying"://租赁经营
                    SelfLeaseListActivity.start(context);
                    break;
                case "0_wodezhuanrang"://我的知产
                    if (SharedPreferenceUtil.getInstance().getSaveBooleanData(SharedPreferenceUtil.PERSON_AUTH, false)) {
                        ActivityJump.jumpToActivity(context, MakeOverPublishMainActivity.class);
                    } else {
                        com.sgb.kjwl.utils.DialogHelper.showDialog(context, "温馨提示", "请先进行实名认证", "确定", new DialogFunction() {
                            @Override
                            public void normalRoundDialog() {
                                CertificationActivity.start(context, "1");
                            }
                        });
                    }
                    break;
                case "0_wodefuwu"://我的服务
                    if (SharedPreferenceUtil.getInstance().getSaveBooleanData(SharedPreferenceUtil.PERSON_AUTH, false)) {
                        ActivityJump.jumpToActivity(context, PublishServiceListActivity.class);
                    } else {
                        com.sgb.kjwl.utils.DialogHelper.showDialog(context, "温馨提示", "请先进行实名认证", "确定", new DialogFunction() {
                            @Override
                            public void normalRoundDialog() {
                                CertificationActivity.start(context, "1");
                            }
                        });
                    }
                    break;
                case "0_wodexuqiu"://我的需求
                    if (SharedPreferenceUtil.getInstance().getSaveBooleanData(SharedPreferenceUtil.PERSON_AUTH, false)) {
                        AddNeedListActivity.startactivity(context);
                    } else {
                        com.sgb.kjwl.utils.DialogHelper.showDialog(context, "温馨提示", "请先进行实名认证", "确定", new DialogFunction() {
                            @Override
                            public void normalRoundDialog() {
                                CertificationActivity.start(context, "1");
                            }
                        });
                    }
                    break;
                case "0_renzhengzhongxin"://认证中心
                    AuthActivity3.start(context);
                    break;
                case "33_chengyuanshouli"://成员受理
                    SpecialMemberActivity.Companion.launch(context);
                    break;
                case "33_yaoqingchengyuan"://邀请成员
                    InviteMemberActivity.Companion.launch(context);
                    break;
                case "33_chengyuandanwei"://成员单位
                    MemberUnitActivity.Companion.launch(context);
                    break;
                case "15_logosheji"://logo设计
                    UpLoadActivity.Companion.launch(context, UpLoadActivity.TYPE_PIC);
                    break;
                case "15_vrquanjing"://vr全景
                    VrListActivity.Companion.launch(context);
                    break;
                case "15_shipinzhanshi"://视频展示
                    UpLoadActivity.Companion.launch(context, UpLoadActivity.TYPE_VIDEO);
                    break;
                case "15_jingyingyewu"://经营业务
                    listMores.clear();
                    listMores.addAll(entity.getList());
                    FastMenuActivity.Companion.launch(context, listMores, mType, "经营业务");
                    break;
                case "15_xuqiugonggao"://需求公告
                    listMores.clear();
                    listMores.addAll(entity.getList());
                    FastMenuActivity.Companion.launch(context, listMores, mType, "需求公告");
                    break;
                case "15_shangpinjingying"://商品经营
                    GoodsListActivity3.start(context);
                    break;
                case "15_jicaijingying"://集采经营
                    FactoryJicaiActivity.start(context);
                    break;
                case "15_shangpinxuqiu"://商品需求
                    ARouter.getInstance().build(Constants.ARouter.PERSONAL_MY_INQUIRY).navigation();
                    break;
                case "15_zulinxuqiu"://租赁需求
                    MyAskLeaseActivity.start(context);
                    break;
                case "15_xufangjicai"://需方集采
                    MyCenterXuFangFaQiActivity.start(context, "1");
                    break;
                case "15_qiyezhuanxiang"://企业专项
                    MyCenterXuFangFaQiActivity.start(context, "2");
                    break;
                case "15_gonggaoguanli"://公告管理
                    WebsiteAnnouncementManagementActivity.Companion.launch(context);
                    break;
                case "17_guanzhudeqiye"://关注的企业
                case "17_guanzhudeshangpin"://关注的商品
                case "17_guanzhudezhaocai"://关注的招采
                case "17_guanzhudepaimai"://关注的拍卖
                case "17_guanzhudejicai"://关注的集采
                case "17_guanzhudegongdui"://关注的工队
                case "17_guanzhudezulin"://关注的租赁
                case "17_guanzhudewuliu"://关注的物流
                case "17_guanzhudeqifu"://关注的企服
                case "17_guanzhudetuandui"://关注的团队
                case "17_guanzhudeyonghu"://关注的用户
                case "17_guanzhudezuzhi"://关注的组织
                    if (!SharedPreferenceUtil.getInstance().getSaveBooleanData(SharedPreferenceUtil.PERSON_AUTH, false)) {
                        ACAdminDialogUtils.showACDialog(ACAdminDialogUtils.TYPE_AUTH_NO_AC, context);
                        return;
                    }
                    IntelligentAttentionActivity.start(context, getPosition(entity.getName()));
                    break;
                case "0_yaoqingbaoming"://邀请报名
                    PickInvitedApplyListActivity.start(context, "1");
                    break;
                case "0_yaoqingjingjia"://邀请竞价
                    PickInvitedApplyListActivity.start(context, "2");
                    break;
                case "0_yaoqingbaojia"://邀请报价
                    MToast.showToast(context, context.getResources().getString(R.string.self_no_permission));
                    break;
                case "0_yaoqingjiameng"://邀请加盟
                    MToast.showToast(context, context.getResources().getString(R.string.self_no_permission));
                    break;
                case "0_shenqinghuiyuan"://申请会员
                    if (SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.LOGIN_TOKEN, "").equals("")) {
                        EventBus.getDefault().postSticky("transport_to_login");
                    } else {
                        String companyNo = SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.COMPANY_NO, "");
                        boolean isPerson = TextUtils.isEmpty(companyNo) || "0".equals(companyNo);
                        if (isPerson) {
                            boolean isAuth = SharedPreferenceUtil.getInstance().getSaveBooleanData(SharedPreferenceUtil.PERSON_AUTH, false);
                            if (isAuth) {
                                MemberInviteOrApplyActivity.startInviteOrApply(context, 0);
                            } else {
                                ACAdminDialogUtils.showACDialog(ACAdminDialogUtils.TYPE_AUTH_NO_NEW_AC, context);
                            }
                        } else {
                            MemberInviteOrApplyActivity.startInviteOrApply(context, 1);
                        }
                    }
                    break;
                case "0_yaoqinghuiyuan"://邀请会员
                    if (SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.LOGIN_TOKEN, "").equals("")) {
                        EventBus.getDefault().postSticky("transport_to_login");
                    } else {
                        String companyNo = SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.COMPANY_NO, "");
                        boolean isPerson = TextUtils.isEmpty(companyNo) || "0".equals(companyNo);
                        if (isPerson) {
                            boolean isAuth = SharedPreferenceUtil.getInstance().getSaveBooleanData(SharedPreferenceUtil.PERSON_AUTH, false);
                            if (isAuth) {
                                MemberInviteOrApplyActivity.startInviteOrApply(context, 0);
                            } else {
                                ACAdminDialogUtils.showACDialog(ACAdminDialogUtils.TYPE_AUTH_NO_NEW_AC, context);
                            }
                        } else {
                            MemberInviteOrApplyActivity.startInviteOrApply(context, 0);
                        }

                    }
                    break;
                case "0_zuzhijiagou"://组织架构
                    MToast.showToast(context, context.getResources().getString(R.string.self_no_permission));
                    break;
                case "0_yuangongjiaru"://员工加入
                    JoinCompanyActivity.start(context);
                    break;
                case "0_quanxianguanli"://权限管理
                    MToast.showToast(context, context.getResources().getString(R.string.self_no_permission));
                    break;
                case "0_pinpaifenji"://品牌分级
                    MToast.showToast(context, context.getResources().getString(R.string.self_no_permission));
                    break;
                case "0_yaoqingchengyuan"://邀请成员
                    InviteMemberActivity.Companion.launch(context);
                    break;
                case "0_caiwuzhongxin"://财务中心
                    CapitalActivity.start(context, false);
                    break;
                case "0_tongxunlu"://通讯录
                    ContactBookActivity.start(context);
                    break;
                case "0_shangpincuxiao"://商品促销
                    MToast.showToast(context, context.getResources().getString(R.string.self_no_permission));
                    break;
                case "0_kaipiaoxinxi"://开票信息
                    String type = SharedPreferenceUtil.getInstance().getSaveIntData(SharedPreferenceUtil.COM_TYPE, 0) == 0
                            ?SharedPreferenceUtil.USER_NO:SharedPreferenceUtil.COMPANY_NO;
                    String no = SharedPreferenceUtil.getInstance().getString(type, "");
                    ARouterStartWebBase.starInvoiceManagement(no,1);
                    break;
                case "0_dizhiguanli"://地址管理
                    WebSiteAddressActivity.Companion.launch(context, mType);
                    break;
                case "0_zhanghuanquan"://账户安全
                    MToast.showToast(context, context.getResources().getString(R.string.self_no_permission));
                    break;
                case "0_erweimamingpian"://二维码名片
                case "18_erweimamingpian":
                    SelfQrCodeActivity.start(context);
                    break;
                case "0_guanfangkefu"://官方客服
                case "18_guanfangkefu":
                    showDialog(context);
                    break;
                case "0_fenxiangapp"://分享app\
                case "18_fenxiangapp":
                    Toast.makeText(context, "正在升级中", Toast.LENGTH_SHORT).show();
                    break;
                case "0_yijianfankui"://意见反馈
                case "18_yijianfankui":
                    SuggestionFeedbackActivity.start(context);
                    break;
                case "0_shezhi"://设置
                case "18_shezhi":
                    SettingActivity.start(context);
                    break;
                case "18_yuangongshenhe":
                    SpecialMenBerNewActivity.start(context);
                    break;
                default:
                    MToast.showToast(context, context.getResources().getString(R.string.self_no_permission));
                    break;
            }
        }
    }

    private int getPosition(String name) {
        int position = -1;
        switch (name) {
            case "17_guanzhudeqiye"://关注的企业
                position = 0;
                break;
            case "17_guanzhudeshangpin"://关注的商品
                position = 1;
                break;
            case "17_guanzhudezhaocai"://关注的招采
                position = 2;
                break;
            case "17_guanzhudepaimai"://关注的拍卖
                position = 3;
                break;
            case "17_guanzhudejicai"://关注的集采
                position = 4;
                break;
            case "17_guanzhudegongdui"://关注的工队
                position = 5;
                break;
            case "17_guanzhudezulin"://关注的租赁
                position = 6;
                break;
            case "17_guanzhudewuliu"://关注的物流
                position = 7;
                break;
            case "17_guanzhudeqifu"://关注的企服
                position = 8;
                break;
            case "17_guanzhudetuandui"://关注的团队
                position = 10;
                break;
            case "17_guanzhudeyonghu"://关注的用户
                position = 9;
                break;
            case "17_guanzhudezuzhi"://关注的组织
                position = 11;
                break;
            case "17_guanzhudezhaoshang"://关注的招商(暂时没有)
            default:
                break;
        }
        return position;
    }


    /**
     * 展开客服弹窗
     */

    private void showDialog(Context context) {
        View view = View.inflate(context, R.layout.dialog_two_btn, null);
        final RoundCornerDialog roundCornerDialog = new RoundCornerDialog(context, 0, 0, view, R.style.RoundCornerDialog);
        roundCornerDialog.show();
        roundCornerDialog.setCanceledOnTouchOutside(false);// 设置点击屏幕Dialog不消失
        //roundCornerDialog.setOnKeyListener(keylistener);//设置点击返回键Dialog不消失
        TextView tv_message = view.findViewById(R.id.tv_message);
        TextView tv_title = view.findViewById(R.id.tv_title);
        TextView tv_logout_confirm = view.findViewById(R.id.tv_logout_confirm);
        TextView tv_logout_cancel = view.findViewById(R.id.tv_logout_cancel);
        tv_title.setText("联系客服");
        tv_title.setVisibility(View.VISIBLE);
        tv_message.setText("400-001-0051");
        tv_logout_confirm.setText("拨打");
        //确定
        tv_logout_confirm.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_DIAL);
                Uri data = Uri.parse("tel:" + "4000010051");
                intent.setData(data);
                context.startActivity(intent);
            }
        });
        //取消
        tv_logout_cancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //关闭弹窗
                roundCornerDialog.dismiss();
            }
        });
    }
}
